import {
  IncomeStream,
  OutlayStream,
  LandingAgency,
  Partners,
  Project,
  User,
  ProjectResources,
  Resource
} from "@/interface/entity";
import { FormPattern, TablePattern } from "@/interface/general";
import { regionData } from "element-china-area-data";

export const validatePattern = {
  正浮点数: /^\d+(\.\d+)?$/,
  非负整数: /^\d+$/g,
  零到一之间的数: /^(0.\d+|0|1)$/,
  零到一百之间的数: /^(100|(([1-9]){1}[0-9]?|0{1})((\.)([0-9]){1,2})?)$/,
  excel: /.sheet|excel$/,
  wordAndppt: /.document$|.presentation$/,
  pdfAndVideoAndImage: /.pdf$|video|image/
};

export const fileNamePatternRegExp = {
  excel: /^(xls|xlsx)$/
};

export const isAuthorizedMap = {
  authorized: "√",
  unauthorized: "x"
};

export const constObjs = {
  // ------------------ form pattern ------------------
  // 项目表单模板对象
  projectFormPattern: {
    formType: "project",
    labelWidth: "180px",
    formItem: [
      // 0
      [
        {
          type: "el-input",
          label: "项目名称",
          placeholder: "请输入项目名称",
          prop: "projectName"
        },
        {
          type: "el-autocomplete",
          label: "项目负责人",
          placeholder: "请输入项目负责人",
          prop: "projectManager",
          // will got when init
          options: []
        }
      ],
      // todo ceshi
      [
        {
          type: "el-input",
          label: "项目码",
          placeholder: "请输入项目码（不填为空）",
          prop: "projectNum"
        },
        {
          type: "el-select",
          label: "项目类型",
          placeholder: "请输入项目类型",
          prop: "categories",
          options: [
            { value: "示范性国培", label: "示范性国培" },
            { value: "中西部国培", label: "中西部国培" },
            { value: "省级项目", label: "省级项目" },
            { value: "区域项目", label: "区域项目" },
            { value: "非区域项目", label: "非区域项目" }
          ]
        }
      ],
      // 所属地
      [
        {
          type: "el-cascader",
          label: "项目所属地",
          placeholder: "请输入项目所属地",
          prop: "selectedArea",
          options: regionData
        },
        {
          type: "el-date-picker",
          label: "备案申请日期",
          placeholder: "请输入备案时间",
          prop: "createdDate"
        }
      ],
      [
        {
          type: "el-select",
          label: "培训模式",
          placeholder: "请输入培训模式",
          prop: "trainingMode",
          options: [
            { value: "集中培训", label: "集中培训" },
            { value: "网络研修", label: "网络研修" },
            { value: "混合研修", label: "混合研修" }
          ]
        },
        {
          type: "el-input",
          label: "收费标准",
          placeholder: "请输入收费标准",
          prop: "chargeStandard"
        }
      ],
      [
        {
          type: "el-input",
          label: "培训人数",
          placeholder: "请输入培训人数",
          prop: "trainingNumOfPerson"
        },
        {
          type: "el-input",
          label: "培训学时数",
          placeholder: "请输入培训学时数",
          prop: "trainingTimes"
        }
      ],
      [
        {
          type: "el-date-picker",
          label: "培训开始时间",
          placeholder: "请输入备案时间",
          prop: "trainingStartTime"
        },
        {
          type: "el-date-picker",
          label: "培训结束时间",
          placeholder: "请输入备案时间",
          prop: "trainingEndTime"
        }
      ],
      [
        {
          type: "el-date-picker",
          label: "合同开始时间",
          placeholder: "请输入备案时间",
          prop: "contractStartTime"
        },
        {
          type: "el-date-picker",
          label: "合同结束时间",
          placeholder: "请输入备案时间",
          prop: "contractEndTime"
        }
      ],
      // 经费
      [
        {
          type: "el-input",
          label: "合同编号",
          placeholder: "请输入合同编号",
          prop: "contractNum"
        },
        {
          type: "el-input-number",
          label: "项目应收总经费",
          placeholder: "请输入项目应收总经费",
          prop: "projectFund",
          min: 0
        }
      ],
      // 学校管理费比例
      [
        {
          type: "el-input-number",
          label: "学校管理费比例(%)",
          placeholder: "请输入学校管理费比例",
          prop: "schoolManageRadio",
          min: 0,
          max: 100
        },
        {
          type: "el-input",
          label: "学校管理费",
          prop: "schoolManageAmount",
          isReadOnly: true
        }
      ],
      [
        {
          type: "el-input-number",
          label: "发展基金比例(%)",
          placeholder: "请输入发展基金比例",
          prop: "devFundingRadio",
          min: 0,
          max: 100
        },
        {
          type: "el-input",
          label: "发展基金",
          prop: "devFundingAmount",
          isReadOnly: true
        }
      ],
      [
        {
          type: "el-input-number",
          label: "福利比例(%)",
          placeholder: "请输入福利比例",
          prop: "welfareRadio",
          min: 0,
          max: 100
        },
        {
          type: "el-input",
          label: "福利",
          prop: "welfareAmount",
          isReadOnly: true
        }
      ],
      [
        {
          type: "el-input-number",
          label: "课酬比例(%)",
          placeholder: "请输入课酬比例",
          prop: "classPayRadio",
          min: 0,
          max: 100
        },
        {
          type: "el-input",
          label: "课酬",
          prop: "classPayAmount",
          isReadOnly: true
        }
      ],
      // todo client
      {
        type: "multi",
        prop: "clients",
        label: "添加委托方 ",
        gutter: 0,
        isShowAddButton: true,
        spanList: [7, 4, 5],
        labelList: ["名称", "分成比例(%)", "分成"],
        keyList: ["agencyName", "shareRadio", "shareAmount"],
        itemType: ["el-input", "el-input-number", "el-input"],
        // shareAmount is readonly
        isDisabled: [false, false, true],
        subRule: {
          shareRadio: [
            {
              pattern: validatePattern.零到一百之间的数,
              message: "分成比例必须为0~100之间的数"
              // trigger: "blur"
            }
          ]
        }
      },
      {
        type: "multi",
        prop: "landingAgencies",
        label: "添加落地机构 ",
        gutter: 0,
        isShowAddButton: true,
        spanList: [7, 4, 5],
        labelList: ["名称", "分成比例(%)", "分成"],
        keyList: ["agencyName", "shareRadio", "shareAmount"],
        itemType: ["el-input", "el-input-number", "el-input"],
        // shareAmount is readonly
        isDisabled: [false, false, true],
        subRule: {
          shareRadio: [
            {
              pattern: validatePattern.零到一百之间的数,
              message: "分成比例必须为0~100之间的数"
              // trigger: "blur"
            }
          ]
        }
      },
      // 技术合作方
      {
        type: "multi",
        prop: "partners",
        label: "添加技术合作方",
        gutter: 0,
        isShowAddButton: true,
        spanList: [6, 4, 4, 4, 4],
        // todo 改了这里
        labelList: ["名称", "分成比例(%)", "分成", "计算方式", "类型"],
        keyList: [
          "partnerName",
          "shareRadio",
          "shareAmount",
          "caculation",
          "partnerType"
        ],
        itemType: [
          "el-input",
          "el-input-number",
          "el-input",
          "el-select",
          "el-input"
        ],
        subOptions: {
          caculation: [
            { label: "公式", value: "公式" },
            { label: "比例", value: "比例" }
          ]
        },
        // shareAmount is readonly
        isDisabled: [false, false, true, false],
        subRule: {
          shareRadio: [
            {
              pattern: validatePattern.零到一百之间的数,
              message: "分成比例必须为0~100之间的数"
              // trigger: "blur"
            }
          ],
          caculation: [
            {
              required: true,
              message: "请输入该技术方分成的计算方式",
              trigger: "blur"
            }
          ]
        }
      }
    ]
  } as FormPattern,
  // 支出流水表单模板对象
  outlayStreamFormPattern: {
    formType: "outlayStream",
    labelWidth: "200px",
    formItem: [
      [
        {
          type: "el-input",
          label: "支出项目码",
          placeholder: "支出项目码",
          prop: "outlayProjectCode"
        },
        {
          type: "el-date-picker",
          label: "支出日期",
          placeholder: "支出日期",
          prop: "createdDate"
        }
      ],
      {
        type: "form-item-list",
        formItemListType: "el-input-number",
        prop: "clients",
        label: "委托方分成",
        key: "shareAmount",
        insertIndex: 3,
        isReadonly: false
      },
      {
        type: "form-item-list",
        formItemListType: "el-input-number",
        prop: "landingAgencies",
        label: "落地机构分成",
        key: "shareAmount",
        insertIndex: 4,
        isReadonly: false
      },
      {
        type: "form-item-list",
        formItemListType: "el-input-number",
        prop: "partners",
        label: "技术方分成",
        key: "shareAmount",
        insertIndex: 5,
        isReadonly: false
      },
      //
      [
        {
          type: "el-input-number",
          label: "专家课酬",
          placeholder: "专家课酬",
          prop: "payG",
          min: 0
        },
        {
          type: "el-input-number",
          label: "方案费",
          placeholder: "方案费",
          prop: "payH",
          min: 0
        },
        {
          type: "el-input-number",
          label: "网络研修教学费",
          placeholder: "网络研修教学费",
          prop: "payI",
          min: 0
        }
      ],
      [
        {
          type: "el-input-number",
          label: "管理及工作人员劳务费",
          placeholder: "管理及工作人员劳务费",
          prop: "payJ",
          min: 0
        },
        {
          type: "el-input-number",
          label: "考察、跟岗、线下指导费",
          placeholder: "考察、跟岗、线下指导费",
          prop: "payK",
          min: 0
        },
        {
          type: "el-input-number",
          label: "专家食宿",
          placeholder: "专家食宿",
          prop: "payL",
          min: 0
        }
      ],
      [
        {
          type: "el-input-number",
          label: "专家及工作人员交通费",
          placeholder: "专家及工作人员交通费",
          prop: "payM",
          min: 0
        },
        {
          type: "el-input-number",
          label: "学员伙食费",
          placeholder: "学员伙食费",
          prop: "payN",
          min: 0
        },
        {
          type: "el-input-number",
          label: "学员住宿费",
          placeholder: "学员住宿费",
          prop: "payO",
          min: 0
        }
      ],
      [
        {
          type: "el-input-number",
          label: "学员交通费",
          placeholder: "学员交通费",
          prop: "payP",
          min: 0
        },
        {
          type: "el-input-number",
          label: "场租",
          placeholder: "场租",
          prop: "payQ",
          min: 0
        },
        {
          type: "el-input-number",
          label: "课程资源建设费（人员支出）",
          placeholder: "课程资源建设费（人员支出）",
          prop: "payR",
          min: 0
        }
      ],
      [
        {
          type: "el-input-number",
          label: "课程资源建设费（购买）",
          placeholder: "课程资源建设费（购买）",
          prop: "payS",
          min: 0
        },
        {
          type: "el-input-number",
          label:
            "培训资料费、办公用品费、保险费、医药费及其他（含购买标书、中标服务费等）",
          placeholder:
            "培训资料费、办公用品费、保险费、医药费及其他（含购买标书、中标服务费等）",
          prop: "payT",
          min: 0
        }
      ],
      // 备注
      [
        {
          type: "el-input",
          label: "备注",
          placeholder: "备注",
          prop: "remarks"
        }
      ]
    ]
  } as FormPattern,
  // todo 收入流水表单模板对象
  incomeStreamFormPattern: {
    formType: "incomeStream",
    labelWidth: "200px",
    formItem: [
      [
        {
          type: "el-autocomplete",
          label: "是否预先借票",
          placeholder: "是否预先借票",
          prop: "isBorrowed",
          options: [
            { label: "是", value: "是" },
            { label: "否", value: "否" }
          ]
        },
        {
          type: "el-autocomplete",
          label: "是否已冲账",
          placeholder: "是否已冲账",
          prop: "isOffset",
          options: [
            { label: "是", value: "是" },
            { label: "否", value: "否" }
          ]
        }
      ],
      [
        {
          type: "el-input",
          label: "缴费单位",
          placeholder: "缴费单位",
          prop: "payUnit"
        },
        {
          type: "el-input",
          label: "发票抬头",
          placeholder: "发票抬头",
          prop: "invoice"
        }
      ],
      [
        {
          type: "el-input-number",
          label: "入账金额",
          placeholder: "入账金额",
          prop: "incomeAmount",
          min: 0
        },
        {
          type: "el-date-picker",
          label: "入账日期",
          placeholder: "分账日期",
          prop: "createdDate"
        }
      ],
      {
        type: "form-item-list",
        formItemListType: "el-input-number",
        prop: "clients",
        label: "委托方分成",
        key: "shareAmount",
        insertIndex: 3,
        isReadonly: true
      },
      {
        type: "form-item-list",
        formItemListType: "el-input-number",
        prop: "landingAgencies",
        label: "落地机构分成",
        key: "shareAmount",
        insertIndex: 4,
        isReadonly: true
      },
      {
        type: "form-item-list",
        formItemListType: "el-input-number",
        prop: "partners",
        label: "技术方分成",
        key: "shareAmount",
        insertIndex: 3,
        isReadonly: true
      },
      [
        {
          type: "el-input",
          label: "入账凭证编码",
          placeholder: "入账凭证编码",
          prop: "incomeValidCode"
        }
      ],
      [
        {
          type: "el-input-number",
          label: "专家课酬",
          placeholder: "专家课酬",
          prop: "payG",
          min: 0
        },
        {
          type: "el-input-number",
          label: "方案费",
          placeholder: "网络研修教学费",
          prop: "payH",
          min: 0
        },
        {
          type: "el-input-number",
          label: "网络研修教学费",
          placeholder: "网络研修教学费",
          prop: "payI",
          min: 0
        },
        {
          type: "el-input-number",
          label: "管理及工作人员劳务费",
          placeholder: "管理及工作人员劳务费",
          prop: "payJ",
          min: 0
        }
      ],
      [
        {
          type: "el-input-number",
          label: "考察、跟岗、线下指导费",
          placeholder: "考察、跟岗、线下指导费",
          prop: "payK",
          min: 0
        },
        {
          type: "el-input-number",
          label: "专家食宿",
          placeholder: "专家食宿",
          prop: "payL",
          min: 0
        },
        {
          type: "el-input-number",
          label: "专家及工作人员交通费",
          placeholder: "专家及工作人员交通费",
          prop: "payM",
          min: 0
        }
      ],
      [
        {
          type: "el-input-number",
          label: "学员伙食费",
          placeholder: "学员伙食费",
          prop: "payN",
          min: 0
        },
        {
          type: "el-input-number",
          label: "学员住宿费",
          placeholder: "学员住宿费",
          prop: "payO",
          min: 0
        },
        {
          type: "el-input-number",
          label: "学员交通费",
          placeholder: "学员交通费",
          prop: "payP",
          min: 0
        }
      ],
      [
        {
          type: "el-input-number",
          label: "场租",
          placeholder: "场租",
          prop: "payQ",
          min: 0
        },
        {
          type: "el-input-number",
          label: "课程资源建设费（人员支出）",
          placeholder: "课程资源建设费（人员支出）",
          prop: "payR",
          min: 0
        },
        {
          type: "el-input-number",
          label: "课程资源建设费（购买）",
          placeholder: "课程资源建设费（购买）",
          prop: "payS",
          min: 0
        }
      ],
      [
        {
          type: "el-input-number",
          label:
            "培训资料费、办公用品费、保险费、医药费及其他（含购买标书、中标服务费等）",
          placeholder:
            "培训资料费、办公用品费、保险费、医药费及其他（含购买标书、中标服务费等）",
          prop: "payT",
          min: 0
        }
      ],
      [
        {
          type: "el-date-picker",
          label: "开票日期",
          placeholder: "开票日期",
          prop: "invoiceIssueDate"
        },
        {
          type: "el-input-number",
          label: "发票金额",
          placeholder: "发票金额",
          prop: "invoiceAmount"
        }
      ],
      [
        {
          type: "el-input-number",
          label: "发票数量",
          placeholder: "发票数量",
          prop: "invoiceCount",
          precision: 0,
          min: 0
        },
        {
          type: "el-input",
          label: "发票号码",
          placeholder: "发票号码",
          prop: "invoiceCode"
        },
        {
          type: "el-date-picker",
          label: "分账日期",
          placeholder: "分账日期",
          prop: "splitAmountDate"
        }
      ],
      // 备注
      [
        {
          type: "el-input",
          label: "备注",
          placeholder: "备注",
          prop: "remarks"
        }
      ]
    ]
  } as FormPattern,

  // todo 普通用户编辑信息

  // 管理员编辑用户信息（权限）
  userPermissionFormPattern: {
    formType: "userPermission",
    labelWidth: "150px",
    formItem: [
      [
        {
          type: "el-input",
          label: "用户名",
          placeholder: "请输入用户名",
          prop: "username"
        },
        {
          type: "el-input",
          label: "密码",
          placeholder: "请输入密码",
          prop: "password"
        },
        {
          type: "el-select",
          label: "更新用户",
          prop: "updateMyUser",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        }
      ],
      //to system
      [
        {
          type: "el-select",
          label: "项目系统",
          prop: "projectSystem",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        },
        {
          type: "el-select",
          label: "收入流水系统",
          prop: "incomeStreamSystem",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        },
        {
          type: "el-select",
          label: "支出流水系统",
          prop: "outlayStreamSystem",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        }
      ],
      // add
      [
        {
          type: "el-select",
          label: "添加项目",
          prop: "addProject",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        },
        {
          type: "el-select",
          label: "添加收入流水",
          prop: "addIncomeStream",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        },
        {
          type: "el-select",
          label: "添加支出流水",
          prop: "addOutlayStream",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        }
      ],
      // delete
      [
        {
          type: "el-select",
          label: "删除项目",
          prop: "deleteProject",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        },
        {
          type: "el-select",
          label: "删除收入流水",
          prop: "deleteIncomeStream",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        },
        {
          type: "el-select",
          label: "删除支出流水",
          prop: "deleteOutlayStream",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        }
      ],
      // update
      [
        {
          type: "el-select",
          label: "更新项目",
          prop: "updateProject",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        },
        {
          type: "el-select",
          label: "更新收入流水",
          prop: "updateIncomeStream",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        },
        {
          type: "el-select",
          label: "更新支出流水",
          prop: "updateOutlayStream",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        },
        {
          type: "el-select",
          label: "更新项目资源",
          prop: "projectResource",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        }
      ],
      [
        {
          type: "el-select",
          label: "查询项目",
          prop: "queryAllProject",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        },
        {
          type: "el-select",
          label: "查询收入流水",
          prop: "queryAllIncomeStream",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        },
        {
          type: "el-select",
          label: "查询支出流水",
          prop: "queryAllOutlayStream",
          options: [
            {
              value: isAuthorizedMap.authorized,
              label: isAuthorizedMap.authorized
            },
            {
              value: isAuthorizedMap.unauthorized,
              label: isAuthorizedMap.unauthorized
            }
          ]
        }
      ]
    ]
  } as FormPattern,

  // ------------------ initial form data ------------------
  // 项目表单对象
  projectForm: {
    projectGuid: "",
    projectName: "",
    projectManager: "",
    selectedArea: [] as string[],
    // 收费标准, 这里是数组，只有一行
    chargeStandard: "",
    // 项目应收经费为0
    projectFund: (undefined as unknown) as number,
    categories: "",
    createdDate: "",
    projectNum: "",
    trainingMode: "",
    trainingNumOfPerson: "",
    trainingTimes: "",
    trainingStartTime: (undefined as unknown) as Date,
    trainingEndTime: (undefined as unknown) as Date,
    contractNum: "",
    contractStartTime: (undefined as unknown) as Date,
    contractEndTime: (undefined as unknown) as Date,
    // todo client
    clients: [
      {
        agencyName: "无",
        shareRadio: 0,
        shareAmount: 0
      }
    ] as LandingAgency[],
    landingAgencies: [
      {
        agencyName: "无",
        shareRadio: 0,
        shareAmount: 0
      }
    ] as LandingAgency[],
    partners: [
      {
        partnerName: "无",
        shareRadio: 0,
        shareAmount: 0,
        caculation: "比例",
        partnerType: "无"
      }
    ] as Partners[],
    schoolManageRadio: 0,
    devFundingRadio: 0,
    welfareRadio: 0,
    classPayRadio: 0,
    // 已到账金额
    paidAmount: 0,
    // ...
    schoolManageAmount: 0,
    welfareAmount: 0,
    classPayAmount: 0,
    devFundingAmount: 0,
    payGin: 0,
    payGout: 0,
    payHin: 0,
    payHout: 0,
    payIin: 0,
    payIout: 0,
    payJin: 0,
    payJout: 0,

    payKin: 0,
    payKout: 0,
    payLin: 0,
    payLout: 0,
    payMin: 0,
    payMout: 0,
    payNin: 0,
    payNout: 0,
    payOin: 0,
    payOout: 0,
    payPin: 0,
    payPout: 0,
    payQin: 0,
    payQout: 0,
    payRin: 0,
    payRout: 0,
    paySin: 0,
    paySout: 0,
    payTin: 0,
    payTout: 0
  } as Project,
  // 支出流水表单对象
  outlayStreamForm: {
    projectGuid: "",
    createdDate: (undefined as unknown) as Date,
    outlayProjectCode: "",
    payG: (undefined as unknown) as number,
    payH: (undefined as unknown) as number,
    payI: (undefined as unknown) as number,
    payJ: (undefined as unknown) as number,
    payK: (undefined as unknown) as number,
    payL: (undefined as unknown) as number,
    payM: (undefined as unknown) as number,
    payN: (undefined as unknown) as number,
    payO: (undefined as unknown) as number,
    payP: (undefined as unknown) as number,
    payQ: (undefined as unknown) as number,
    payR: (undefined as unknown) as number,
    payS: (undefined as unknown) as number,
    payT: (undefined as unknown) as number,
    // totalPay 初始化为0，且表单模板中没有该项，根据前面的pay累加得到
    totalPay: 0
  } as OutlayStream,
  // 收入流水表单对象
  incomeStreamForm: {
    projectGuid: "",
    // 入账日期
    createdDate: (undefined as unknown) as Date,
    isOffset: "",
    //是否预先借票
    isBorrowed: "",
    // 缴费单位
    payUnit: "",
    // 入账金额
    incomeAmount: (undefined as unknown) as number,
    // 发票抬头
    invoice: "",
    // 入账凭证编码
    incomeValidCode: "",

    // todo创建流水时，这三个为空数组，不存在数据库里面。读取流水的时候在前端生成
    clients: [] as LandingAgency[],
    landingAgencies: [] as LandingAgency[],
    partners: [] as Partners[],

    // 开票日期
    invoiceIssueDate: (undefined as unknown) as Date,
    // 发票金额
    invoiceAmount: (undefined as unknown) as number,
    // 发票数量
    invoiceCount: (undefined as unknown) as number,
    // 发票号码
    invoiceCode: "",
    // 分账日期
    splitAmountDate: (undefined as unknown) as Date,

    // 学校管理费 等
    schoolManageAmount: 0,
    welfareAmount: 0,
    devFundingAmount: 0,
    classPayAmount: 0,
    payG: 0,
    payH: 0,
    payI: 0,
    payJ: 0,
    payK: 0,
    payL: 0,
    payM: 0,
    payN: 0,
    payO: 0,
    payP: 0,
    payQ: 0,
    payR: 0,
    payS: 0,
    payT: 0
  } as IncomeStream,
  // 用户表单对象
  userPermissionForm: {
    username: "",
    password: "",
    permissionString: "",
    // system
    projectSystem: isAuthorizedMap.unauthorized,
    incomeStreamSystem: isAuthorizedMap.unauthorized,
    outlayStreamSystem: isAuthorizedMap.unauthorized,

    // user
    updateMyUser: isAuthorizedMap.unauthorized,

    // project
    queryAllProject: isAuthorizedMap.unauthorized,
    addProject: isAuthorizedMap.unauthorized,
    deleteProject: isAuthorizedMap.unauthorized,
    updateProject: isAuthorizedMap.unauthorized,

    // incomestream
    queryAllIncomeStream: isAuthorizedMap.unauthorized,
    addIncomeStream: isAuthorizedMap.unauthorized,
    deleteIncomeStream: isAuthorizedMap.unauthorized,
    updateIncomeStream: isAuthorizedMap.unauthorized,

    // outlaystream
    queryAllOutlayStream: isAuthorizedMap.unauthorized,
    addOutlayStream: isAuthorizedMap.unauthorized,
    deleteOutlayStream: isAuthorizedMap.unauthorized,
    updateOutlayStream: isAuthorizedMap.unauthorized
  } as User,

  // ------------------ table pattern ------------------
  // 收入流水表头
  incomeStreamTablePattern: [] as TablePattern[],

  // 支出流水表头
  outlayStreamTablePattern: [] as TablePattern[],

  // 项目列表表头
  projectsTablePattern: [] as TablePattern[],

  // 项目资源表头(一类资源)
  resourceListPattern: [
    { prop: "name", label: "文件（点击文件名下载）", isShow: true },
    { prop: "createdDate", label: "上传日期", isShow: true }
  ] as TablePattern[],

  // 用户信息表头
  userPermissionTablePattern: [
    { label: "用户名", prop: "username", isShow: true },
    { label: "密码", prop: "password", isShow: true },
    // 权限
    // system
    { label: "项目系统", prop: "projectSystem", isShow: true },
    { label: "收入流水系统", prop: "incomeStreamSystem", isShow: true },
    { label: "支出流水系统", prop: "outlayStreamSystem", isShow: true },
    // todo add delete update query user
    { label: "更新用户", prop: "updateMyUser", isShow: true },
    // project

    { label: "添加项目", prop: "addProject", isShow: true },
    { label: "删除项目", prop: "deleteProject", isShow: true },
    { label: "更新项目", prop: "updateProject", isShow: true },
    { label: "更新项目资源", prop: "projectResource", isShow: true },
    { label: "查询项目", prop: "queryAllProject", isShow: true },

    // incomestream
    { label: "添加收入流水", prop: "addIncomeStream", isShow: true },
    { label: "删除收入流水", prop: "deleteProject", isShow: true },
    { label: "更新收入流水", prop: "updateProject", isShow: true },
    { label: "查询收入流水", prop: "queryAllIncomeStream", isShow: true },

    // outlaystream
    { label: "添加支出流水", prop: "addOutlayStream", isShow: true },
    { label: "删除支出流水", prop: "deleteOutlayStream", isShow: true },
    { label: "更新支出流水", prop: "updateOutlayStream", isShow: true },
    { label: "查询支出流水", prop: "queryAllOutlayStream", isShow: true }
  ] as TablePattern[],

  //--------------projectresources---------------------
  projectResources: {
    projectGuid: "",
    resources: [
      {
        fileType: "备案材料",
        discription:
          "办班申请表、责任书、培训方案、文件通知、项目审批表、专家论证报告、预算表（测算版）、合同（WORD版及签章扫描件）、培训手册",
        resource: [] as Resource[]
      },
      {
        fileType: "物资准备",
        discription:
          "物资需求、办公用品申请表、课室申请、人员需求、疫情项目报备",
        resource: [] as Resource[]
      },
      {
        fileType: "问卷调查",
        discription: "训前（培训需求）、训中、训后",
        resource: [] as Resource[]
      },
      {
        fileType: "经费及支出",
        discription:
          "预算（正式版）、决算（正式版）、发票扫描件、学生助理信息、专家课酬、培训费用发票信息、日常报销、学员保单、学员住宿发票、学员饭卡转账单",
        resource: [] as Resource[]
      },
      {
        fileType: "培训宣传",
        discription: "集体照、新闻稿",
        resource: [] as Resource[]
      },
      {
        fileType: "学员档案资料",
        discription: "学员名单、签到表、考勤表",
        resource: [] as Resource[]
      },
      {
        fileType: "各类函",
        discription: "专家邀请函、专家授课证书",
        resource: [] as Resource[]
      },
      {
        fileType: "结业证书",
        discription: "证书登记表、各类证书模版",
        resource: [] as Resource[]
      },
      {
        fileType: "培训成果",
        discription: "学员美篇、班主任总结、委托单位意见表",
        resource: [] as Resource[]
      }
    ]
  } as ProjectResources,

  fileTypeList: [
    "备案材料",
    "物资准备",
    "问卷调查",
    "经费及支出",
    "培训宣传",
    "学员档案资料",
    "各类函",
    "结业证书",
    "培训成果"
  ],

  //--------------------userpermissionlist-----------000
  permissionMapList: [
    "projectSystem",
    "incomeStreamSystem",
    "outlayStreamSystem",
    "updateMyUser",
    "queryAllProject",
    "addProject",
    "deleteProject",
    "updateProject",
    "projectResource",
    "queryAllIncomeStream",
    "addIncomeStream",
    "deleteIncomeStream",
    "updateIncomeStream",
    "queryAllOutlayStream",
    "addOutlayStream",
    "deleteOutlayStream",
    "updateOutlayStream"
  ],

  //-------------------label-prop map
  projectLabelPropMap: {
    备案申请日期: "createdDate",
    项目类型: "categories",
    项目名称: "projectName",
    项目码: "projectNum",
    创建账户: "creator",
    项目负责人: "projectManager",
    培训模式: "trainingMode",
    收费标准: "chargeStandard",
    项目所属地: "selectedArea",
    培训学时数: "trainingTimes",
    培训人数: "trainingNumOfPerson",
    培训开始时间: "trainingStartTime",
    培训结束时间: "trainingEndTime",
    合同开始时间: "contractStartTime",
    合同结束时间: "contractEndTime",
    合同编号: "contractNum",
    项目应收费用: "projectFund",
    当前已到账费用: "paidAmount",
    未到账金额: "unpaidAmount",
    落地机构: "agencyName",
    技术方: "partnerName",
    落地机构分成比例: "shareRadio",
    落地机构分成: "shareAmount",
    技术方分成比例: "shareRadio",
    技术方分成: "shareAmount",
    学校管理费比例: "schoolManageRadio",
    学校管理费180043: "schoolManageAmount",
    发展基金比例: "devFundingRadio",
    发展基金210098: "devFundingAmount",
    福利比例: "welfareRadio",
    福利220121: "welfareAmount",
    课酬比例: "classPayRadio",
    课酬440120: "classPayAmount",
    费用支出合计: "outlayAmount",
    项目盈亏金额: "profitlossAmount"
  },

  incomeStreamLabelPropMap: {
    入账日期: "createdDate",
    项目类型: "categories",
    是否预先借票: "isBorrowed",
    项目码: "projectNum",
    是否已冲账: "isOffset",
    项目名称: "projectName",
    缴费单位: "payUnit",
    发票抬头单位名称: "invoice",
    入账金额: "incomeAmount",
    入账凭证编码: "incomeValidCode",
    落地机构: "agencyName",
    技术方: "partnerName",
    落地机构分成比例: "shareRadio",
    落地机构分成: "shareAmount",
    技术方分成比例: "shareRadio",
    技术方分成: "shareAmount",
    // 落地机构返款时间: "rebateTime",
    // 技术合作方返款时间: "rebateTime",
    学校管理费比例: "schoolManageRadio",
    学校管理费180043: "schoolManageAmount",
    发展基金比例: "devFundingRadio",
    发展基金210098: "devFundingAmount",
    福利比例: "welfareRadio",
    福利220121: "welfareAmount",
    课酬比例: "classPayRadio",
    课酬440120: "classPayAmount",
    发票开出日期: "invoiceIssueDate",
    发票金额: "invoiceAmount",
    发票数量: "invoiceCount",
    发票号码: "invoiceCode",
    分账日期: "splitAmountDate",
    备注: "remarks"
  },

  outlayStreamLabelPropMap: {
    支出日期: "createdDate",
    项目类型: "categories",
    支出项目码: "outlayProjectCode",
    项目分类: "categories",
    项目名称: "projectName",
    是否借款: "isLoaned",
    专家课酬: "payG",
    网络研修教学费: "payH",
    工作人员劳务费: "payI",
    考察_跟岗_线下指导费: " payJ",
    专家食宿: "payK",
    专家交通费: "payL",
    学员伙食费: "payM",
    学员住宿费: "payN",
    学员交通费: "payO",
    场租: "payP",
    课程资源建设费_人员支出: "payQ",
    课程资源建设费_购买: "payR",
    培训资料费_办公用品费_保险费_医药费及其他: "payS"
  },

  timeOut: 300
};
